import time


def sort(list1):
    for i in range(0, len(list1) - 1):
        for j in range(len(list1) - 1):
            if list1[j] > list1[j + 1]:
                temp = list1[j]
                list1[j] = list1[j + 1]
                list1[j + 1] = temp
    return list1  # vozvrat zna4enia


m1 = list(map(int, open('m1_sorted.txt', 'r')))
m2 = list(map(int, open('m2_reverse.txt', 'r')))
m3 = list(map(int, open('m3_shuffle.txt', 'r')))

m1_time_check = sort(m1)

t_st = time.time()
sort(m1)
t_f = time.time()
print('m1_sorted', round((t_f - t_st) * 1000), 'milliseconds')
t_st = time.time()
sort(m2)
t_f = time.time()
print('m2_reverse', round((t_f - t_st) * 1000), 'milliseconds')
t_st = time.time()
sort(m3)
t_f = time.time()
print('m3_shuffle', round((t_f - t_st) * 1000), 'milliseconds')
